﻿using EA.DAO;
using EA.DTO;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EA.BA
{
    public class ProductImageBA : ObjectBA
    {

        public List<ProductImageTO> GetProductImageByProductID(int productID)
        {
            List<ProductImageTO> list = new List<ProductImageTO>();
            ProductImageDA productCategoryDA = new ProductImageDA(ObjectBA.ConnectionString);
            DataTable table = productCategoryDA.GetUrlByProductID(productID);
            for (int i = 0; i < table.Rows.Count;i++ )
            {
                ProductImageTO productTO = new ProductImageTO();
                productTO.ID = (int)table.Rows[i]["ID"];
                productTO.ProductID = EA.Common.Converts.getValueInteger("ProductID",i,table);
                productTO.URL =table.Rows[i]["URL"].ToString();
                list.Add(productTO);
            }
            return list;
        }

    }
}
